package cn.izeno.wx.models.component

class WeappAllCate : InnerList<WeappAllCate.Category> {
  override lateinit var data: List<Category>

  @Deprecated("仅解析数据用")
  fun setCategoriesList(data: CategoryList) {
    this.data = data.categories
  }


  class Category {
    /**  类目ID */
    var id: Int? = 0
    var name: String? = ""
    var level: Int? = 0
    var father: Int? = 0

//    var children: List<Int>? = listOf()

    /**
     * 是否为敏感类目
     * - 1 为敏感类目，需要提供相应资质审核
     * - 0 为非敏感类目，无需审核
     */
    var sensitiveType: Int? = 0

    var certs: List<Cert>? = null

    @Deprecated("仅解析数据用")
    fun setQualify(qualify: Qualify) {
      val certs = qualify.exterList.flatMap { it.innerList }
      if (certs.isNotEmpty()) {
        this.certs = certs
      }
    }
  }


  @Deprecated("仅解析数据用")
  class CategoryList {
    lateinit var categories: List<Category>
  }


  @Deprecated("仅解析数据用")
  class Qualify {
    lateinit var exterList: List<Exter>
  }

  @Deprecated("仅解析数据用")
  class Exter {
    lateinit var innerList: List<Cert>
  }

  class Cert {
    lateinit var name: String
    lateinit var url: String
  }
}
